<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
	<% String path=request.getContextPath(); String basePath=request.getScheme() + "://" + request.getServerName() + ":"
		+ request.getServerPort() + path + "/" ; %>

		<!DOCTYPE html>
		<html>

		<head>
			<base href="<%=basePath%>">

			<title>附件表</title>

			<meta http-equiv="pragma" content="no-cache">
			<meta http-equiv="cache-control" content="no-cache">
			<meta http-equiv="expires" content="0">
			<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
			<meta http-equiv="description" content="This is my page">
			<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

		</head>

		<body>
			<%@ include file="/WEB-INF/jsp/common/header.jsp" %>
				<%@ include file="/WEB-INF/jsp/common/loadDiv.jsp" %>

					<script type="text/javascript">
						$(function () {
							$('#startTime').datebox('setValue', getBeforeCurrentDate30Days());
							$('#endTime').datebox('setValue', getNowFormatDate());
							bindgrid();
						});
					</script>
					<script>
						function del(node) {
							$.ajax({
								type: "delete",
								url: 'sys/file/delete?fileId=fileId',
								//                dataType: "xml",				
								success: function (data) {
									$.messager.alert('消息', data);
									$('#add').window('close');
									bindgrid();
								},
								error: function (XMLHttpRequest, textStatus, errorThrown) {
									$.messager.alert('消息', errorThrown);
								}
							});
						}

						function save() {
							$('#fm').form('submit', {
								url: 'sys/file/save',
								iframe: false,
								onSubmit: function () {
									return $(this).form('validate');
								},
								success: function (result) {
									var result = eval('(' + result + ')');
									if (result.errorMsg) {
										$.messager.show({
											title: 'Error',
											msg: result.errorMsg
										});
									} else {
										$('#dlg').dialog('close'); // close the dialog
										$('#dg').datagrid('reload'); // reload the user data
									}
								}
							});
						}

						function editrow() {

						}
					</script>
					<script>
						function selectList() {
							var startTime = $('#startTime').datebox('getValue')
							var endTime = $('#endTime').datebox('getValue')
							var dg = $('#dg');
							dg.datagrid('enableFilter');
							dg.datagrid('load', {
								startTime: startTime ? startTime : '',
								endTime: endTime ? endTime : ''
							});
						}
						function bindgrid() {
							var startTime = $('#startTime').datebox('getValue')
							var endTime = $('#endTime').datebox('getValue')
							$('#dg').datagrid({
								title: '附件列表',
								url: "sys/file/selectList",
								iconCls: 'icon-application',
								width: getWidth(0.98),
								queryParams: {
									startTime: startTime,
									endTime: endTime
								},
								height: 415,
								filterDelay: 0,
								nowrap: true,
								rownumbers: true,
								animate: false,
								collapsible: false,
								clientPaging: false,
								remoteFilter: true,
								singleSelect: true,
								pagination: true,
								remoteSort: true,
								columns: [[{
									field: 'fileId',
									title: '附件ID',
									sortable: true,
									hidden: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'fileName',
									title: '文件名',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'fileUrl',
									title: '文件路径',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'fileTable',
									title: '来源表',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'fileCol',
									title: '来源列',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'fileRow',
									title: '来源行',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'fileCreatetime',
									title: '附件创建时间',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'createTime',
									title: 'create_time',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'createName',
									title: 'create_name',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'createId',
									title: 'create_id',
									sortable: true,
									hidden: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'updateId',
									title: 'update_id',
									sortable: true,
									hidden: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'updateName',
									title: 'update_name',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'updateTime',
									title: 'update_time',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'delFlag',
									title: 'del_flag',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'status',
									title: 'status',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}, {
									field: 'remark',
									title: 'remark',
									sortable: true,
									formatter: function (val, rec) {
										return val ? unescape(val) : '';
									}
								}]],
								toolbar: [],
								onLoadSuccess: function () {
								},
								onDblClickRow: function () {
									editrow();
								}
							});
							$('#dg').datagrid('enableFilter');
						}
					</script>
					<style scoped="scoped">
						.textbox {
							height: 20px;
							margin: 0;
							padding: 0 2px;
							box-sizing: content-box;
						}

						/*.table tr {
        height: 15px;
    }*/
					</style>
					<div style="margin: 5px 0px">
						<%-- 搜索框 --%>
							<label style="font-size: 12px;">创建时间：</label> <input class="easyui-datebox" name="startTime"
								id="startTime"
								data-options="required:true,showSeconds:false,formatter:myformatter,parser:myparser"
								value="" style="width: 150px"> <label style="font-size: 10px;">~</label> <input
								class="easyui-datebox" name="endTime" id="endTime"
								data-options="required:true,showSeconds:false,formatter:myformatter,parser:myparser"
								style="width: 150px" /> <a id="search" style="margin-left: 30px"
								href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
								onclick="selectList()">查询</a>
					</div>
					<table id="dg"></table>


					<div id="add" class="easyui-window" closed="true" modal="true" title="用户信息"
						style="width: 500px; height: 450px; padding: 10px 20px">
						<form id="fm" class="ssec-form">
							<table class="table">
								<tr>
									<td>
										<div class="ssec-label">附件ID：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="fileId" name="fileId" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">文件名：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="fileName" name="fileName" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">文件路径：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="fileUrl" name="fileUrl" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">来源表：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="fileTable" name="fileTable" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">来源列：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="fileCol" name="fileCol" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">来源行：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="fileRow" name="fileRow" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">附件创建时间：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="fileCreatetime" name="fileCreatetime"
												class="easyui-validatebox textbox" data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">create_time：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="createTime" name="createTime" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">create_name：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="createName" name="createName" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">create_id：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="createId" name="createId" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">update_id：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="updateId" name="updateId" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">update_name：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="updateName" name="updateName" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">update_time：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="updateTime" name="updateTime" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">del_flag：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="delFlag" name="delFlag" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">status：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="status" name="status" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<div class="ssec-label">remark：</div>
									</td>
									<td>
										<div class="ssec-text normal">
											<input id="remark" name="remark" class="easyui-validatebox textbox"
												data-options="required:true" />
										</div>
									</td>
								</tr>
							</table>
							<div style="padding: 5px; text-align: right;">
								<a class="easyui-linkbutton" onclick="save();" iconcls="icon-save">保存</a>
							</div>
						</form>
					</div>
		</body>

		</html>